<template>
  <div class="component-icon-btn" @click="handleUndo">
    <div class="component-icon-btn-icon">
      <svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
        <path d="M6 2.763v7.544l-4.29-3.73zM13 14v-3a4 4 0 00-4-4H6V6h3a5 5 0 015 5v3h-1z" fill="#3D4757" />
      </svg>
    </div>
  </div>
</template>

<script>
import {
  undoManager
} from '../Utils.js'

export default {
  props: {
    context: {
      type: Object,
      required: true
    }
  },
  data: function() {
    return {

    }
  },
  mounted: function() {

  },
  methods: {
    handleUndo() {
      if (undoManager.hasUndo()) {
        undoManager.undo()
      } else {
        this.$message('当前没有内容可以撤销')
      }
    }
  }
}
</script>
